
package com.trydofor.id.byta;

import com.trydofor.aloe.exception.Exceptions;

/**
 * a packet with head and body.
 * 
 * <pre>
 *  if got javac's "incompatible types found" error, see
 *  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5049523
 * </pre>
 * 
 * @author : Shi Rongjiu (www.trydofor.com)
 */
public final class Packet {
    
    private final Head       head;
    private final Bytable<?> body;
    
    /**
     * constructor.
     * 
     * @param head the head
     * @param body the body
     * @throws NullPointerException if head or body is null
     */
    public Packet(Head head, Bytable<?> body) {
        Exceptions.checkNullPointer(head);
        Exceptions.checkNullPointer(body);
        
        this.head = head;
        this.body = body;
    }
    
    /**
     * @return the head
     */
    public Head getHead() {
        return head;
    }
    
    /**
     * @return the body
     */
    public Bytable<?> getBody() {
        return body;
    }
}
